
def buildConnectionString(params):
    """The comments are better sent in english"""
    return ";".join(["%s=%s" % (k, v) for k, v in params.items()])
    
#if __name__ == "__main__":
myParams = {"login":"root", \
                "password":"admin", \
                "uid":"sa"}
                
print myParams["password"]
myParams["password"] = "parrasite"
print myParams["password"]

myParams["newvariable"] = "123"
print myParams

myParams[30] = 30
print myParams

del myParams["newvariable"]
print myParams


"""Checking lists"""
lst = ['q', 123, "qwerty", "z", 2222, 5]
print lst[0:lst.__len__()]
lst2 = lst[:]

print lst, lst2
lst.insert(2, lst2)
print lst

v = ('a', 'b', 's')
(x,y,z) = v
print (x ,y, z)

v = range(100)
print v

a = b ="nya!" 
print "%s ^_^ %s" % (a, b)

lst3 = range(1000)
print [elem*elem for elem in lst3]

print myParams.keys()
print myParams.values()
print myParams.items()

print ["%s=%s" % (k,v) for k, v in myParams.items()]

print dir(myParams)

a=0
b=1

while b<10:
    print b
    a, b = b, a + b

num = int(raw_input("Print the digit ", ))
if num < 0:
    num = 0
    print "Changed negative to positive"
elif num == 0:
    print "Zero"
elif num > 0:
    print "Positive digit"  
    
lst4 = ['a', 'b', 123, '234234234']
for x in lst4:
    print x

print raw_input().__doc__    

def function(prompt, retries=4, complaint="Yes or No please"):
    while True:
        ok = raw_input(prompt).lower()
        if ok in ('y', 'ye', 'yes'):
            return True
        if ok in ('n', 'no'):
            return False
        retries -= 1
        if retries < 1:
            print complaint
            
function('Are your going to burn this world?')

def make(a):
    return lambda x: x**a

f2 = make(2)
f4 = make(4)

for x in [2,4,6]: print f2(x)
for x in [2,4,6]: print f4(x)